export const MIME_TYPES = {
  FOLDER: 'folder',

  // 文本类型
  TEXT: 'text/plain',
  HTML: 'text/html',
  CSS: 'text/css',
  CSV: 'text/csv',
  XML: 'text/xml',
  
  // 图片类型
  JPEG: 'image/jpeg',
  PNG: 'image/png',
  GIF: 'image/gif',
  SVG: 'image/svg+xml',
  
  // 音频类型
  MP3: 'audio/mpeg',
  WAV: 'audio/wav',
  OGG_AUDIO: 'audio/ogg',
  
  // 视频类型
  MP4: 'video/mp4',
  WEBM: 'video/webm',
  OGG: 'video/ogg',
  
  // 应用程序类型
  OCTET_STREAM: 'application/octet-stream',
  PDF: 'application/pdf',
  ZIP: 'application/zip',
  JSON: 'application/json',
  FORM_DATA: 'application/x-www-form-urlencoded',
  
  // 其他常见类型
  JAVASCRIPT: 'application/javascript',
  FONT_WOFF: 'application/font-woff',
  FONT_TTF: 'application/font-ttf',
  FONT_OTF: 'application/font-otf',
  FONT_SFNT: 'application/font-sfnt',
  XHTML: 'application/xhtml+xml',
  XLSX: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  DOCX: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  PPTX: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
};


export const getFileTypeByExtendName = (objectName) => {
  const sepIndex = objectName.lastIndexOf('.')
  if (sepIndex === -1) {
    return MIME_TYPES.OCTET_STREAM
  }
  const extendName = objectName.slice(sepIndex + 1).trim().toUpperCase()

  return MIME_TYPES[extendName] || 'application/octet-stream';
}